package cn.juque.abstractfactory.service;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>BydEnum</li>
 * </ul>
 * @date 2023-06-11 22:57:12
 **/
public enum BydEnum {

    /**
     * enums
     */
    WANG_CHAO("wangchao", new WangchaoPipelineServiceImpl()),
    OCEAN("ocean", new OceanPipelineServiceImpl()),
    ;
    private final String model;

    private final BydPipelineService pipelineService;

    BydEnum(String model, BydPipelineService pipelineService) {
        this.model = model;
        this.pipelineService = pipelineService;
    }

    public String getModel() {
        return model;
    }

    public BydPipelineService getPipelineService() {
        return pipelineService;
    }

    public static BydPipelineService forPipeline(String model) {
        for (BydEnum bydEnum : BydEnum.values()) {
            if(bydEnum.getModel().equals(model)) {
                return bydEnum.getPipelineService();
            }
        }
        return null;
    }
}
